package app.poller.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import app.poller.R;

public class SplashScreen extends Activity {
	
	Thread fakeWaitThread;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash_screen);
        fakeWaitThread = new Thread(new Runnable() {
        	
        	public void run() {
        		
        		try {
        		Thread.sleep(1000);
				runOnUiThread(new Runnable() {
					public void run() {
						Intent x = new Intent(getApplicationContext(), MainActivity.class);
						startActivity(x);
						finish();
					}
				});
        		}
        		catch(InterruptedException ie) {
        			ie.printStackTrace();
        		}
        	}
		});
        fakeWaitThread.start();
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_splash_screen, menu);
        return true;
    }
    
    @Override
    public void onBackPressed() {
    	fakeWaitThread.interrupt();
    	super.onBackPressed();
    }
    
    @Override
    protected void onDestroy() {
    	super.onDestroy();
    }
}
